<?php
define("__ACTIVE_PAGE__", "new-broadcast");
require_once dirname(__FILE__).'/init.php';

if ($_POST){
	$message = new CompanyMessages();
	$message->companyId = $company->id;
	$message->title = $_POST["title"];
	$message->text = $_POST["text"];
	$message->amount = $_POST["amount"];
	$message->count = 0;
	$message->save(false);
	
	notifyBroadcastMessageAllUsers();
	
	header("location:broadcast.php");
	die();
}

?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<?php require dirname(__FILE__).'/common/head.php'; ?>
	</head>
	<body>
		<?php require dirname(__FILE__).'/common/header.php'; ?>
		<div class="container">
			<div class="row">
				<div class="span12">
					<h4>New Message</h4>
					<form method="post" action="" class="form-horizontal">
						<div class="control-group">
							<label class="control-label" for="inputEmail">Amount</label>
							<div class="controls">
								<select  name="amount">
									<option>10</option>
									<option>20</option>
									<option>30</option>
									<option>40</option>
									<option>50</option>
									<option>100</option>
								</select>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Title</label>
							<div class="controls">
								<input type="text" id="inputEmail" name="title">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputPassword">Text</label>
							<div class="controls">
								<textarea  name="text"></textarea>
							</div>
						</div>
						<div class="control-group">
							<div class="controls">
								<button type="submit" class="btn btn-primary">Save</button>
								<a href="index.php" class="btn">Cancel</a>
							</div>
						</div>
					</form>
					
				</div>
			</div>
			<?php require dirname(__FILE__).'/common/footer.php'; ?>
		</div> 
	</body>
</html>







